Tuple: Tuple cannot change

34

# tuple cannot be changed

my_list =  [3, 4, 5]
my_tuple = (3, 4, 5)

my_list[0] =  9
my_tuple[0] = 9 # TypeError: 'tuple' object does not support item assignment

print(my_list)
print(my_tuple)

Comments

Submit
0 Comments